package com.example.xunai.dto.request.ai;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class BatchChatRequest {
    @NotEmpty(message = "请求列表不能为空")
    private List<ChatRequest> requests;

    @NotNull(message = "用户ID不能为空")
    private Long userId;

    private String batchId;

    public static BatchChatRequest of(List<ChatRequest> requests, Long userId) {
        return new BatchChatRequest(requests, userId, null);
    }

    public static BatchChatRequest of(List<ChatRequest> requests, Long userId, String batchId) {
        return new BatchChatRequest(requests, userId, batchId);
    }

    public boolean isValid() {
        return requests != null && !requests.isEmpty() && userId != null;
    }

    public int getRequestCount() {
        return requests != null ? requests.size() : 0;
    }
}